package 一对一通信;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class SendDemo {

	public static void main(String[] args) {
		try {
			DatagramSocket ds = new DatagramSocket();
			System.out.println("Please write down...");
			while(true){
				BufferedReader br = new BufferedReader(new InputStreamReader(
						System.in));
				String sen=br.readLine();
				if(sen=="886") {
					break;
				}
				byte[] data = sen.getBytes("GBK");
				DatagramPacket dp = new DatagramPacket(data, data.length,
						InetAddress.getByName("192.168.11.29"), 9090);
				ds.send(dp);
			}
			ds.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
